﻿using J.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;

namespace J.ProductSet.Controllers
{
    /// <summary>
    /// 价格库存管理(写)
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PriceInventoryControlController : ControllerBase
    {
        private readonly ISqlSugarClient _sqlSugarClient;
        public PriceInventoryControlController(ISqlSugarClient sqlSugarClient)
        {
            _sqlSugarClient = sqlSugarClient;
        }
        /// <summary>
        /// 价格库存管理添加
        /// </summary>
        /// <param name="Aggregate"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> PriceInventoryControlPost(PriceInventoryControl PriceInven)
        {
            return Ok(await _sqlSugarClient.Insertable(PriceInven).ExecuteCommandAsync());
        }
        /// <summary>
        /// 价格库存管理删除
        /// </summary>
        /// <param name="PriceInventoryID"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> PriceInventoryControlDelete(int PriceInventoryID)
        {
            return Ok(await _sqlSugarClient.Deleteable<PriceInventoryControl>(new PriceInventoryControl() { PriceInventoryID = PriceInventoryID }).ExecuteCommandAsync());
        }
        /// <summary>
        /// 价格库存管理修改
        /// </summary>
        /// <param name="PriceInven"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> PriceInventoryControlUpdate(PriceInventoryControl PriceInven)
        {
            return Ok(await _sqlSugarClient.Updateable(PriceInven).ExecuteCommandAsync());
        }
    }
}
